<?php
namespace Test\Controller;
use Common\Model\GameModel;
use Common\Model\RedpackModel;
use Think\Controller;
class IndexController extends Controller {
    private function getMethods($classname,$access=null){
        $class = new \ReflectionClass($classname);
        $methods = $class->getMethods();
        $returnArr = array();
        foreach($methods as $value){
            if($value->class == $classname){
                if($access != null){
                    $methodAccess = new \ReflectionMethod($classname,$value->name);
                    switch($access){
                        case 'public':
                            if($methodAccess->isPublic())$returnArr[$value->name] = 'public';
                            break;
                        case 'protected':
                            if($methodAccess->isProtected())$returnArr[$value->name] = 'protected';
                            break;
                        case 'private':
                            if($methodAccess->isPrivate())$returnArr[$value->name] = 'private';
                            break;
                        case 'final':
                            if($methodAccess->isFinal())$returnArr[$value->name] = 'final';
                            break;
                    }
                }else{
                    array_push($returnArr,$value->name);
                }

            }
        }
        return $returnArr;
    }
    public function index(){
        $method=$this->getMethods(get_class($this),'public');
        ksort($method);
        $last='';
        foreach($method as $k=>$v){
            $now=substr($k,0,2);
            if($now<>$last){
                echo '<hr />';
                $last=$now;
            }
            echo "<a href='",U($k),"' >{$k}</a><br />";
        }


        $CardExt=array(
            //'card_id'	=> $wxCardID,
            'code'		=> 'code',
            'openid'	=> 'openid',
            'timestamp'	=> 'time',
            'signature'	=> 'signature',

            'outer_id'	=> 0,
            //'api_ticket'=>$card_ticket,

        );


    }

    public function createPack(){
        $orderId=91;
        $game=GameModel::getGameInstance()->where('gid='.$orderId)->find();
        RedpackModel::createRecord($game['gid'],$game['totalPrize'],$game['packNum'],$game['packMin']);
    }

}